package com.aaa.service.impl;

import com.aaa.entity.Facility;
import com.aaa.entity.User;
import com.aaa.mapper.UserMapper;
import com.aaa.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public PageInfo<User> query(String uname,String phone,Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);//将当前页和每页的数量放到PageHelper
        List<User> users = userMapper.query(uname,phone);//接受前台返回结果集
        PageInfo<User> pageInfo = new PageInfo<>(users);//用PageInfo分页处理数据
        return pageInfo; //返回结果
    }

    @Override
    public Integer updateState(Integer id, String state) {
        return userMapper.updState(id,state);
    }
}
